#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>

using namespace std;
int check[100005] = { 0 };
int arr[100005] = { 0 };
int dp[100005] = { 0 };

int main()
{
	int n, k;
	long long ret = 0;
	cin >> n >> k;
	check[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		cin >> arr[i];
		dp[i] = (dp[i - 1] + arr[i]) % k;
		ret += check[dp[i]];
		check[dp[i]]++;
	}

	cout << ret;

	return 0;
}